<template>

  <el-dialog width="26%" title="题目审核" :visible="showAudit" :before-close="()=>$emit('update:showAudit', false)">
    <el-form size="mini">
      <el-form-item>
        <el-radio v-model="radio" label=1>通过</el-radio>
        <el-radio v-model="radio" label=2>拒绝</el-radio>
      </el-form-item>
      <el-form-item>
        <el-input

          prop="textarea"
          size="small"
          type="textarea"
          :autosize="{ minRows: 2, maxRows: 4}"
          placeholder="请输入审核意见"
          v-model="textarea">
        </el-input>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
    <el-button @click="$emit('update:showAudit', false)">取 消</el-button>
    <el-button type="primary" @click="btnisOK">确 定</el-button>
  </span>
  </el-dialog>
</template>

<script>

import { auditPass } from '@/api/hmmm/questions'

export default {
  name: 'audit',
  props: {
    showAudit: {
      type: Boolean,
      default: false
    },
    row: {
      type: Object

    }
  },
  data () {
    return {
      radio: '0',
      textarea: ''

    }
  },
  methods: {

    async btnisOK () {
      if (this.textarea === '') {
        this.$message({
          message: '请输入审核意见',
          type: 'warning'
        })
        return
      }
      const data = {
        id: this.row.id,
        chkState: Number(this.radio),
        chkRemarks: this.textarea
      }
      const res = await auditPass(data)
      console.log(res)
      this.$store.dispatch('questionsRandoms/getAsyncRandomsListParams', {})

      this.$emit('update:showAudit', false)
    }

  }

}
</script>
<style scoped>

</style>
